#include "IPAddress.h"
#include "IP4Address.h"
#include "IP6Address.h"

namespace yzrilyzr_net{
	std::shared_ptr<IPAddress> IPAddress::parse(const yzrilyzr_lang::String & str){
		if(str.contains(":")){
			return IP6Address::parse(str);
		} else{
			return IP4Address::parse(str);
		}
	}
	bool IPAddress::isIPV4(const IPAddress * addr){
		return addr->getVersion() == 4;
	}
	bool IPAddress::isIPV6(const IPAddress * addr){
		return addr->getVersion() == 6;
	}
}